package com.biaobiaoqi.scoreanalysis.hibernate.bean;

import java.util.Date;
import java.util.List;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.JoinColumn;
import javax.persistence.JoinTable;
import javax.persistence.ManyToMany;
import javax.persistence.ManyToOne;

import com.biaobiaoqi.scoreanalysis.util.SchoolType;

@Entity
public class Examination extends BaseBean {
	@Column(nullable = false)
	private String name;
	@Column(nullable = false)
	private Date date;
	@ManyToOne
	private SchoolYear schoolYear;
	@Column(nullable=false)
	private SchoolType schoolType;
	@ManyToOne
	@JoinColumn(nullable=false)
	private ClazzType clazzType;

	@ManyToMany
	@JoinTable(name = "exam_course", 
	joinColumns = @JoinColumn(name = "exam_id"), 
	inverseJoinColumns = @JoinColumn(name = "course_id"))
	private List<Course> courses;

	@ManyToMany
	@JoinTable(name="exam_clazz",
	joinColumns = @JoinColumn(name="exam_id"),
	inverseJoinColumns = @JoinColumn(name="clazz_id"))
	private List<Clazz> clazzs;

	@ManyToMany
	@JoinTable(name ="exam_student",
	joinColumns = @JoinColumn(name="exam_id"),
	inverseJoinColumns = @JoinColumn(name="student_id"))
	private List<Student> students;

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public Date getDate() {
		return date;
	}

	public void setDate(Date date) {
		this.date = date;
	}

	public List<Course> getCourses() {
		return courses;
	}

	public void setCourses(List<Course> courses) {
		this.courses = courses;
	}

	public List<Clazz> getClazzs() {
		return clazzs;
	}

	public void setClazzs(List<Clazz> clazzs) {
		this.clazzs = clazzs;
	}

	public List<Student> getStudents() {
		return students;
	}

	public void setStudents(List<Student> students) {
		this.students = students;
	}

	public SchoolYear getSchoolYear() {
		return schoolYear;
	}

	public void setSchoolYear(SchoolYear schoolYear) {
		this.schoolYear = schoolYear;
	}

	public ClazzType getClazzType() {
		return clazzType;
	}

	public void setClazzType(ClazzType clazzType) {
		this.clazzType = clazzType;
	}

	public SchoolType getSchoolType() {
		return schoolType;
	}

	public void setSchoolType(SchoolType schoolType) {
		this.schoolType = schoolType;
	}
}
